package com.me.modules.sys.service.impl;

import com.me.modules.sys.dao.OperationDao;
import com.me.modules.sys.entity.OperationEntity;
import com.me.modules.sys.service.OperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Date : 2018/12/18 15:59
 * @Author : zhenglei
 * @Desc : 业务系统
 */
@Service("operationService")
public class OperationServiceimpl implements OperationService {
    @Autowired
    private OperationDao operationDao;
    @Override
    public OperationEntity queryObject(Integer id) {
        return operationDao.queryObject(id);
    }

    @Override
    public List<OperationEntity> queryList(Map<String, Object> map) {
        return operationDao.queryList(map);
    }

    @Override
    public List<OperationEntity> queryListByBean(OperationEntity operation) {
        return operationDao.queryListByBean(operation);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return operationDao.queryTotal(map);
    }

    @Override
    public Integer save(OperationEntity operation) {
        return operationDao.save(operation);
    }

    @Override
    public int update(OperationEntity operation) {
        return operationDao.update(operation);
    }

    @Override
    public int delete(Integer id) {
        return operationDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return operationDao.deleteBatch(ids);
    }

    @Override
    public void updateIsdel(String ids, Integer type) {
        for (String id:ids.split(",")){
            OperationEntity operationEntity = new OperationEntity();
            operationEntity.setId(Integer.parseInt(id));
            operationEntity.setDeleteStatus(type);
            operationDao.update(operationEntity);
        }
    }
}
